public class num1524 {
    public int numOfSubarrays(int[] arr) {
        int ans = 0;
        int odd = 0;
        int even = 1;
        int sum = 0;
        int size = arr.length;
        for (int i = 0; i < size; i++) {
            sum += arr[i];
            ans += (sum % 2 == 0 ? odd : even);
            if(sum % 2 == 0) {
                odd ++;
            }else {
                even ++;
            }
        }
        return (ans % 1000000007);
    }
}
